var express = require("express");
var router = express.Router();

var data = require("../data/movies");
var sings = require("../data/sings");
var music = require("../data/music");
var recommend = require("../data/recommend");

router.get("/banner", function (req, res, next) {
  res.json({
    success: true,
    data: [
      {
        id: 1,
        url: "/images/banner1.png",
        alt: "神券天天领",
        link: "",
      },
      {
        id: 2,
        url: "/images/banner2.png",
        alt: "周华健演唱会",
        link: "",
      },
      {
        id: 3,
        url: "/images/banner3.png",
        alt: "祁隆全国巡演",
        link: "",
      },
    ],
  });
});

router.get("/movies", function (req, res, next) {
  res.json({
    success: true,
    data: {
      hot: {
        movies: data.filter((item) => item.playType === 1),
        total: data.filter((item) => item.playType === 1).length,
      },
      wait: {
        movies: data.filter((item) => item.playType === 2),
        total: data.filter((item) => item.playType === 2).length,
      },
      coming: {
        movies: data.filter((item) => item.playType === 3),
        total: data.filter((item) => item.playType === 3).length,
      },
    },
  });
});

router.get("/shows", function (req, res, next) {
  res.json({
    success: true,
    data: {
      sings: {
        data: sings,
        total: sings.length,
      },
      music: {
        data: music,
        total: music.length,
      },
    },
  });
});

router.get("/recommend", function (req, res, next) {
  res.json({
    success: true,
    data: recommend,
  });
});

module.exports = router;
